import Vue from 'vue'
import Router from 'vue-router'
import routes from './routes'

Vue.use(Router)

const router = new Router({
  base: process.env.BASE_URL,
  routes
})

router.beforeEach((to, from, next) => {
  // if (to.path === '/login') {
  //   next()
  // } else {
  //   let token = localStorage.getItem('token')
  //   if (token === null) {
  //     next('/login')
  //   } else {
  //     next()
  //   }
  // }
  next()
})

export default router
